/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.ebc.icontatos.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;

/**
 *
 * @author linux
 */
@Entity
public class Emissora implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long idEmissora;

    private String descricaoEmissora;
    
    @ManyToMany(mappedBy = "emissoras")
    private List<Usuario> usuarios;

	public Emissora() {
	}

	public Long getIdEmissora() {
		return idEmissora;
	}

	public void setIdEmissora(Long idEmissora) {
		this.idEmissora = idEmissora;
	}

	public String getDescricaoEmissora() {
		return descricaoEmissora;
	}

	public void setDescricaoEmissora(String descricaoEmissora) {
		this.descricaoEmissora = descricaoEmissora;
	}

	public List<Usuario> getUsuarios() {
		return usuarios;
	}

	public void setUsuarios(List<Usuario> usuarios) {
		this.usuarios = usuarios;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime
				* result
				+ ((descricaoEmissora == null) ? 0 : descricaoEmissora
						.hashCode());
		result = prime * result
				+ ((idEmissora == null) ? 0 : idEmissora.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Emissora other = (Emissora) obj;
		if (descricaoEmissora == null) {
			if (other.descricaoEmissora != null)
				return false;
		} else if (!descricaoEmissora.equals(other.descricaoEmissora))
			return false;
		if (idEmissora == null) {
			if (other.idEmissora != null)
				return false;
		} else if (!idEmissora.equals(other.idEmissora))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Emissora [idEmissora=" + idEmissora + "]";
	}
    
}
